import { computed, reactive, provide, watch } from "vue";
let i = 0;
export default function setup(props, context) {
  console.log(props);
  let model = reactive({
    doc: {
      name: "doc" + i,
      list: new Array(10).fill(1).map((item, i) => ({ i, name: Math.random() * 10 }))
    }
  });
  i++;
  // watch();
  return {
    model,
    setDoc(doc) {
      console.log(this);
      model.doc = doc;
      // Object.assign(doc, s);
    },
    setName(name) {
      model.name = "doc" + i;
      i++;
    },
    setList(list) {
      console.log(list);
      model.doc.list = list;
    }
  };
}
